package jellyfishumbrella.tikis;

import java.awt.EventQueue;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;

import javax.swing.JTextField;

import org.lwjgl.LWJGLException;

import jellyfishumbrella.tikis.GameLogic;
import com.jellyfishumbrella.GL.RendererGL;

public class Main {
	private static final String LOOKANDFEEL = "System";

	GameLogic gameLogic;
	JTextField txtDebug;

	RendererGL displayGL;
	long lastFrame;
	int fps;
	long lastFPS;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Main frame = new Main();
					// frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Main() {
		createGUI3D();
		gameLogic = new GameLogic();
		try {
			displayGL.connectToLogic(gameLogic);
		} catch (LWJGLException e) {
			e.printStackTrace();
		}
		gameLogic.init();
		gameLogic.gameLoop();
	}

	public void createGUI3D() {
		try {
			displayGL = new RendererGL();
		} catch (LWJGLException e) {
			e.printStackTrace();
		}
	}

	public class MouseZoomListener implements MouseWheelListener {

		@Override
		public void mouseWheelMoved(MouseWheelEvent e) {
			int notches = e.getWheelRotation();
			System.out.println(notches + "   " + GameLogic.SCALING);
			if (notches < 0) {
				gameLogic.renderGL.camera.FOV /= 2.0;
			} else {
				gameLogic.renderGL.camera.FOV *= 2.0;
			}
			// gamePanel.repaint();
		}
	}

}
